package com.cmc.cloud.cmclink.doc.service.impl.si;

import java.util.Collection;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import com.cmc.cloud.cmclink.doc.entity.BlnoFreightDetailDO;
import com.cmc.cloud.cmclink.doc.mapper.BlnoFreightDetailMapper;
import com.cmc.cloud.cmclink.doc.service.si.BlnoFreightDetailService;
import com.cmes.framework.mybatis.core.query.LambdaQueryWrapperX;

/**
 * 海运费附加费详情 Service 实现类
 *
 * @author 集运管理员
 */
@Service
@Validated
public class BlnoFreightDetailServiceImpl implements BlnoFreightDetailService {

    @Resource
    private BlnoFreightDetailMapper blnoFreightDetailMapper;

    @Override
    public void deleteBlnoFreightDetail(Long id) {
        // 删除
        blnoFreightDetailMapper.deleteById(id);
    }

    @Override
    public void deleteByBlnoIdList(Collection<Long> ids) {
        LambdaQueryWrapperX<BlnoFreightDetailDO> queryWrapperX = new LambdaQueryWrapperX<>();
        queryWrapperX.in(BlnoFreightDetailDO::getBlnoId, ids);
        blnoFreightDetailMapper.delete(queryWrapperX);
    }

    @Override
    public void insertBatchFreight(List<BlnoFreightDetailDO> detailDOList) {
        blnoFreightDetailMapper.insertBatch(detailDOList);
    }

    @Override
    public BlnoFreightDetailDO getBlnoFreightDetail(Long id) {
        return blnoFreightDetailMapper.selectById(id);
    }

    @Override
    public List<BlnoFreightDetailDO> getBlnoFreightDetailList(Collection<Long> ids) {
        return blnoFreightDetailMapper.selectBatchIds(ids);
    }

    @Override
    public List<BlnoFreightDetailDO> getBlnoFreightDetailByBlonId(Long blnoId) {
        LambdaQueryWrapperX<BlnoFreightDetailDO> queryWrapperX = new LambdaQueryWrapperX<>();
        queryWrapperX.eq(BlnoFreightDetailDO::getBlnoId, blnoId);
        return blnoFreightDetailMapper.selectList(queryWrapperX);
    }

    @Override
    public List<BlnoFreightDetailDO> getBlnoFreightDetailByBlnoIdList(Collection<Long> blnoIds) {
        LambdaQueryWrapperX<BlnoFreightDetailDO> queryWrapperX = new LambdaQueryWrapperX<>();
        queryWrapperX.in(BlnoFreightDetailDO::getBlnoId, blnoIds);
        return blnoFreightDetailMapper.selectList(queryWrapperX);
    }
}
